package com.leofee.utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class CollectionUtil {

    /**
     * 判断数组是否为 {@code null} 或者 {@code array.length} 是否大于0
     *
     * @param array array
     * @return true / false
     */
    public static boolean isEmpty(Object[] array) {
        return array == null || array.length == 0;
    }

    public static boolean isEmpty(Collection collection) {
        return collection == null || collection.isEmpty();
    }

    public static <E> List<E> newArrayList(E... elements) {
        List<E> list = new ArrayList<>();
        Collections.addAll(list, elements);
        return list;
    }
}
